package Controller;

import java.util.Scanner;

import util.TicTacToeException;

import Model.Game;
import View.GUI;

public class MakeMoveCon {
	
	GUI m;
	Game g;
	Scanner s;
	
	public MakeMoveCon(GUI gui, Game g, Scanner s) {
		
		this.g = g;
		this.m = gui;
		this.s = s;
		
		
	}
	
	public void process() {
		
		while(true) {
		System.out.println("It's Player " + g.currentPlayer.toString() + "'s turn to play");
		System.out.println("Enter an x coordinate to move");
		int x = s.nextInt();
		System.out.println("Enter a y coordinate to move");
		int y = s.nextInt();
		try {
			g.makeMove(x, y);
			//move made with no error
			break;
			 
		} catch (TicTacToeException e) {
			
			System.out.println(e.getMessage() + "\nTry again");
		}
	}
	}
	


}
